<% project_id = session[:selected_project].to_i %>

<!-- Tasks  -->
<!--<img src="/images/tasks.gif" align="left">-->
<h2>Tasks</h2>
<!--<br/>-->

<div class="block_menu">
<b>Filters:</b>
Project: 
<select id="project_selection" onchange="select_project(this.value)">
<option value="0">All</option>
<% @projects.each {|p| -%>
<option value="<%=p.id%>"<%if session[:selected_project].to_i==p.id then%> selected<%end%>><%= p.name %></option>
<%   } -%>
</select>
Resp: 
<select name="" onchange="select_resp(this.value)">
<option value="0">All</option>
<% @resp.each {|u| -%>
<option id="resp<%=u.id%>" value="<%=u.id%>"<%if session[:selected_resp].to_i==u.id then%> selected<%end%>><%= u.name %></option>
<% } -%>
</select>

State: 
<select id="state_combo" onchange="select_state(this.value)">
<option value="0">All (<%=@state_count['all']%>)</option>
<%
 [['Inbox','inbox'],
 ['Next Action','next'],
 ['Waiting','waiting'],
 ['Sometime/Maybe','maybe'],
 ['Reference','ref']].each {|text,state| -%>
<option id="state<%=state%>" value="<%=state%>"<%if session[:selected_state]==state then%> selected<%end%>><%= text %> (<%=@state_count[state]%>)</option>
<% } -%>
</select>

<br/>
<br/>

<b>Actions: </b>

<a class="btnlnk" href="/task/export_csv">CSV Export</a>
<a class="btnlnk" onclick="alert('Export by tag. The export to freemind has not been changed since the subtasking system has been introduced.');" href="/task/export_freemind">Freemind Export</a>

<a class="btnlnk" href="#" onclick="sort_by_priority(); return false;">Sort by priority</a>
<br/>
<br/>


<b>Tags:</b> to add tags to a task: "urgent, work: call my boss". To filter tasks: click a tag name.<br/>
<img id="loading_tags" src="/images/icon_clock.gif" style="display:none;">
<div id="tags" style="inline">
<%= render(:partial=>'tag', :collection=>@tags, :locals=>{:project=>@project}) %>
</div>

</div>

<div id="taskcontent">
<%= render(:partial => "taskcontent", :locals=>{:by_tag=>nil}) %>
</div>

